<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: register.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."register.php";
include LOCALE.LOCALESET."user_fields.php";

$db = mysql_connect($GLOBALS['db_host'], $GLOBALS['db_user'], $GLOBALS['db_password']);
mysql_select_db($GLOBALS['db_name'], $db);   

$sorter_ikkeaktive_etter='etternavn';
if (isset($_GET['sorter_ikkeaktive_etter'])) {
$sorter_ikkeaktive_etter=$_GET['sorter_ikkeaktive_etter'];
}

$query="SELECT * FROM avloser, postkatalog, kommune, fylke 
		WHERE aktiv LIKE 'nei' 
		AND postkatalog.postnr=avloser.postnr 
		AND postkatalog.kom_id=kommune.kom_id 
		AND kommune.fylke_id=fylke.fylke_id 	
		ORDER BY $sorter_ikkeaktive_etter";
	
$result=mysql_query($query);
$num=mysql_numrows($result);

echo 	"<br></br><table class='capmain' border='0' cellpadding='0' align='center'>
		<tr><th>Ikke aktive</th></tr></table>
		<table class='imagetable' border='0' cellpadding='5' align='center'>

		<tr>
			<th><a href='ikke_aktiv.php?sorter_ikkeaktive_etter=etternavn'><b>Etternavn</b></a></th>
			<th><a href='ikke_aktiv.php?sorter_ikkeaktive_etter=fornavn'><b>Fornavn</b></a></th>
			<th><a href='ikke_aktiv.php?sorter_ikkeaktive_etter=poststed'><b>Poststed</b></a></th>
			<th><b>Mobil</b></th>
			<th><a href='ikke_aktiv.php?sorter_ikkeaktive_etter=kommunenavn'><b>Kommune</b></a></th>
			<th><a href='ikke_aktiv.php?sorter_ikkeaktive_etter=fylkenavn'><b>Fylke</b></a></th>
		</tr>";

$i=0;
while ($i < $num) {	
	$avloserid=mysql_result($result,$i,"avloserid");
	$fornavn=mysql_result($result,$i,"fornavn");
	$etternavn=mysql_result($result,$i,"etternavn");
	$poststed=mysql_result($result,$i,"poststed");
	$kommunenavn=mysql_result($result,$i,"kommunenavn");
	$fylkenavn=mysql_result($result,$i,"fylkenavn");
	$mobil=mysql_result($result,$i,"mobil");

	echo " 

	<tr>
		<td><a href='profil.php?avloserid=$avloserid'>$etternavn</a>
		<td>$fornavn</td>
		<td>$poststed</td>
		<td>$mobil</td>
		<td>$kommunenavn</td>
		<td>$fylkenavn</td>
	</tr>";
$i++;
}

echo " </table><br></br>";

require_once THEMES."templates/footer.php";
?>